/*
 * BlackEagleEMSView.java
 */

package blackeagle.ems;

import blackeagle.ems.entities.Department;
import blackeagle.ems.entities.DepartmentCollection;
import blackeagle.ems.entities.Domain;
import blackeagle.ems.entities.DomainCollection;
import blackeagle.ems.entities.Employee;
import blackeagle.ems.entities.EmployeeCollection;
import blackeagle.ems.entities.Game;
import blackeagle.ems.entities.GameCollection;
import blackeagle.ems.entities.Project;
import blackeagle.ems.entities.ProjectCollection;
import blackeagle.ems.entities.Subproject;
import blackeagle.ems.entities.SubprojectCollection;
import java.awt.Toolkit;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import org.jdesktop.application.Action;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;

/**
 * The application's main frame.
 */
public class BlackEagleEMSView extends FrameView {
    private Department deptCurrentObject;
    private Domain domCurrentObject;
    private Employee empCurrentObject;
    private Game gameCurrentObject;
    private Project projCurrentObject;
    private Subproject subpCurrentObject;
    

    public BlackEagleEMSView(SingleFrameApplication app) {
        super(app);
        
        JFrame frame = this.getFrame();
        frame.setResizable(false);
        frame.setTitle("Black Eagle EMS");
        frame.setIconImage(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("/blackeagle/ems/resources/eagle.png")));
        
        

        this.initComponents();
        
        
        
        this.tpMainContent.setSelectedIndex(0);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pMainPanel = new javax.swing.JPanel();
        tpMainContent = new javax.swing.JTabbedPane();
        pDepartment = new javax.swing.JPanel();
        spDepartmentList = new javax.swing.JScrollPane();
        tDepartments = new javax.swing.JTable();
        btnDeptNew = new javax.swing.JButton();
        btnDeptSave = new javax.swing.JButton();
        btnDeptDel = new javax.swing.JButton();
        lblDeptName = new javax.swing.JLabel();
        tfDepartmentName = new javax.swing.JTextField();
        lblDeptNameError = new javax.swing.JLabel();
        lblDeptLead = new javax.swing.JLabel();
        cbDeptLead = new javax.swing.JComboBox();
        btnDepartmentShowDomains = new javax.swing.JButton();
        btnDepartmentShowEmployees = new javax.swing.JButton();
        btnDepartmentShowProjects = new javax.swing.JButton();
        pDomain = new javax.swing.JPanel();
        spDomainList = new javax.swing.JScrollPane();
        tDomains = new javax.swing.JTable();
        btnDomDel = new javax.swing.JButton();
        btnDomNew = new javax.swing.JButton();
        btnDomSave = new javax.swing.JButton();
        tfDomainName = new javax.swing.JTextField();
        lblDomainName = new javax.swing.JLabel();
        lblDomainNameError = new javax.swing.JLabel();
        cbDomainDept = new javax.swing.JComboBox();
        lblDomainDept = new javax.swing.JLabel();
        cbDomainLead = new javax.swing.JComboBox();
        lblDomainLead = new javax.swing.JLabel();
        btnDomainShowSpecialists = new javax.swing.JButton();
        btnDomainShowSubprojects = new javax.swing.JButton();
        pEmployee = new javax.swing.JPanel();
        spEmployeeList = new javax.swing.JScrollPane();
        tEmployees = new javax.swing.JTable();
        btnEmployeeDelete = new javax.swing.JButton();
        btnEmployeeNew = new javax.swing.JButton();
        btnEmployeeSave = new javax.swing.JButton();
        lblEmployeeFirstname = new javax.swing.JLabel();
        tfEmployeeFName = new javax.swing.JTextField();
        lblEmployeeSurname = new javax.swing.JLabel();
        tfEmployeeSurname = new javax.swing.JTextField();
        lblEmployeeSSN = new javax.swing.JLabel();
        tfEmployeeSSN = new javax.swing.JTextField();
        lblEmployeeDept = new javax.swing.JLabel();
        cbEmployeeDept = new javax.swing.JComboBox();
        lblEmployeeFNameErr = new javax.swing.JLabel();
        lblEmployeeSNameErr = new javax.swing.JLabel();
        lblEmployeeSSNErr = new javax.swing.JLabel();
        btnEmployeeShowSpecialities = new javax.swing.JButton();
        btnEmployeeShowSubprojects = new javax.swing.JButton();
        btnEmployeeEditLevels = new javax.swing.JButton();
        pGame = new javax.swing.JPanel();
        spGameList = new javax.swing.JScrollPane();
        tGames = new javax.swing.JTable();
        btnGameDelete = new javax.swing.JButton();
        btnGameNew = new javax.swing.JButton();
        btnGameSave = new javax.swing.JButton();
        lblGameName = new javax.swing.JLabel();
        tfGameName = new javax.swing.JTextField();
        lblGameStart = new javax.swing.JLabel();
        lblGameDeadline = new javax.swing.JLabel();
        tfGameStart = new javax.swing.JTextField();
        tfGameDeadline = new javax.swing.JTextField();
        lblGameLeader = new javax.swing.JLabel();
        cbGameLead = new javax.swing.JComboBox();
        btnGameShowProjects = new javax.swing.JButton();
        btnGameShowEmployees = new javax.swing.JButton();
        lblGameNameError = new javax.swing.JLabel();
        lblGameStartError = new javax.swing.JLabel();
        lblGameDeadlineError = new javax.swing.JLabel();
        btnGameShowInDev = new javax.swing.JButton();
        pProject = new javax.swing.JPanel();
        spProjectList = new javax.swing.JScrollPane();
        tProjects = new javax.swing.JTable();
        btnProjectDelete = new javax.swing.JButton();
        btnProjectNew = new javax.swing.JButton();
        btnProjectSave = new javax.swing.JButton();
        lblProjectName = new javax.swing.JLabel();
        tfProjectName = new javax.swing.JTextField();
        lblProjectLead = new javax.swing.JLabel();
        cbProjectLead = new javax.swing.JComboBox();
        lblProjectDept = new javax.swing.JLabel();
        cbProjectDept = new javax.swing.JComboBox();
        lblProjectGame = new javax.swing.JLabel();
        cbProjectGame = new javax.swing.JComboBox();
        lblProjectDesc = new javax.swing.JLabel();
        spProjectDesc = new javax.swing.JScrollPane();
        taProjectDesc = new javax.swing.JTextArea();
        btnProjectShowSubprojects = new javax.swing.JButton();
        btnProjectShowDev = new javax.swing.JButton();
        lblProjectNameError = new javax.swing.JLabel();
        pSubproject = new javax.swing.JPanel();
        spSubprojectList = new javax.swing.JScrollPane();
        tSubprojects = new javax.swing.JTable();
        btnSubprojectDelete = new javax.swing.JButton();
        btnSubprojectNew = new javax.swing.JButton();
        btnSubprojectSave = new javax.swing.JButton();
        lblSubprojectName = new javax.swing.JLabel();
        tfSubprojectName = new javax.swing.JTextField();
        lblSubprojectLead = new javax.swing.JLabel();
        cbSubprojectLead = new javax.swing.JComboBox();
        lblSubprojectDomain = new javax.swing.JLabel();
        cbSubprojectDomain = new javax.swing.JComboBox();
        lblSubprojectProject = new javax.swing.JLabel();
        cbSubprojectProject = new javax.swing.JComboBox();
        lblSubprojectDescription = new javax.swing.JLabel();
        spSubprojectDesc = new javax.swing.JScrollPane();
        taSubprojectDesc = new javax.swing.JTextArea();
        btnSubprojectShowEmployees = new javax.swing.JButton();
        lblSubprojectNameError = new javax.swing.JLabel();
        mbTopMenu = new javax.swing.JMenuBar();
        javax.swing.JMenu mFile = new javax.swing.JMenu();
        javax.swing.JMenuItem miExit = new javax.swing.JMenuItem();
        mHelp = new javax.swing.JMenu();
        miAbout = new javax.swing.JMenuItem();

        pMainPanel.setMinimumSize(new java.awt.Dimension(800, 600));
        pMainPanel.setName("pMainPanel"); // NOI18N
        pMainPanel.setPreferredSize(new java.awt.Dimension(800, 600));

        tpMainContent.setTabPlacement(javax.swing.JTabbedPane.LEFT);
        tpMainContent.setAutoscrolls(true);
        tpMainContent.setName("tpMainContent"); // NOI18N
        tpMainContent.setPreferredSize(new java.awt.Dimension(800, 600));
        tpMainContent.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                tpMainContent_StateChanged(evt);
            }
        });

        pDepartment.setName("pDepartment"); // NOI18N

        spDepartmentList.setName("spDepartmentList"); // NOI18N

        tDepartments.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "Department Name", "Leader"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tDepartments.setMaximumSize(new java.awt.Dimension(702, 32000));
        tDepartments.setMinimumSize(new java.awt.Dimension(702, 48));
        tDepartments.setName("tDepartments"); // NOI18N
        tDepartments.setPreferredSize(new java.awt.Dimension(702, 150));
        tDepartments.setShowHorizontalLines(false);
        tDepartments.setShowVerticalLines(false);
        tDepartments.getTableHeader().setReorderingAllowed(false);
        this.tDepartments.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        this.tDepartments.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
            public void valueChanged(ListSelectionEvent e){
                tDepartments_valueChanged(e);
            }
        });
        spDepartmentList.setViewportView(tDepartments);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance().getContext().getResourceMap(BlackEagleEMSView.class);
        tDepartments.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("tDepartments.columnModel.title0")); // NOI18N
        tDepartments.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("tDepartments.columnModel.title1")); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance().getContext().getActionMap(BlackEagleEMSView.class, this);
        btnDeptNew.setAction(actionMap.get("btnDeptNew_click")); // NOI18N
        btnDeptNew.setText(resourceMap.getString("btnDeptNew.text")); // NOI18N
        btnDeptNew.setName("btnDeptNew"); // NOI18N

        btnDeptSave.setAction(actionMap.get("btnDeptSave_click")); // NOI18N
        btnDeptSave.setText(resourceMap.getString("btnDeptSave.text")); // NOI18N
        btnDeptSave.setName("btnDeptSave"); // NOI18N

        btnDeptDel.setAction(actionMap.get("btnDeptDel_click")); // NOI18N
        btnDeptDel.setText(resourceMap.getString("btnDeptDel.text")); // NOI18N
        btnDeptDel.setName("btnDeptDel"); // NOI18N

        lblDeptName.setFont(resourceMap.getFont("lblDeptName.font")); // NOI18N
        lblDeptName.setText(resourceMap.getString("lblDeptName.text")); // NOI18N
        lblDeptName.setName("lblDeptName"); // NOI18N

        tfDepartmentName.setFont(resourceMap.getFont("tfDepartmentName.font")); // NOI18N
        tfDepartmentName.setText(resourceMap.getString("tfDepartmentName.text")); // NOI18N
        tfDepartmentName.setName("tfDepartmentName"); // NOI18N

        lblDeptNameError.setForeground(resourceMap.getColor("lblDeptNameError.foreground")); // NOI18N
        lblDeptNameError.setText(resourceMap.getString("lblDeptNameError.text")); // NOI18N
        lblDeptNameError.setName("lblDeptNameError"); // NOI18N

        lblDeptLead.setFont(resourceMap.getFont("lblDeptLead.font")); // NOI18N
        lblDeptLead.setText(resourceMap.getString("lblDeptLead.text")); // NOI18N
        lblDeptLead.setName("lblDeptLead"); // NOI18N

        cbDeptLead.setFont(resourceMap.getFont("cbDeptLead.font")); // NOI18N
        cbDeptLead.setName("cbDeptLead"); // NOI18N

        btnDepartmentShowDomains.setAction(actionMap.get("btnDepartmentShowDomains_click")); // NOI18N
        btnDepartmentShowDomains.setText(resourceMap.getString("btnDepartmentShowDomains.text")); // NOI18N
        btnDepartmentShowDomains.setName("btnDepartmentShowDomains"); // NOI18N

        btnDepartmentShowEmployees.setAction(actionMap.get("btnDepartmentShowEmployees_click")); // NOI18N
        btnDepartmentShowEmployees.setText(resourceMap.getString("btnDepartmentShowEmployees.text")); // NOI18N
        btnDepartmentShowEmployees.setName("btnDepartmentShowEmployees"); // NOI18N

        btnDepartmentShowProjects.setAction(actionMap.get("btnDepartmentShowProjects_click")); // NOI18N
        btnDepartmentShowProjects.setText(resourceMap.getString("btnDepartmentShowProjects.text")); // NOI18N
        btnDepartmentShowProjects.setName("btnDepartmentShowProjects"); // NOI18N

        javax.swing.GroupLayout pDepartmentLayout = new javax.swing.GroupLayout(pDepartment);
        pDepartment.setLayout(pDepartmentLayout);
        pDepartmentLayout.setHorizontalGroup(
            pDepartmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pDepartmentLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pDepartmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblDeptNameError)
                    .addGroup(pDepartmentLayout.createSequentialGroup()
                        .addGroup(pDepartmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblDeptName)
                            .addComponent(tfDepartmentName, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(152, 152, 152)
                        .addGroup(pDepartmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblDeptLead)
                            .addComponent(cbDeptLead, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(pDepartmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pDepartmentLayout.createSequentialGroup()
                            .addComponent(btnDeptDel)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(btnDeptNew)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(btnDeptSave))
                        .addComponent(spDepartmentList, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 704, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pDepartmentLayout.createSequentialGroup()
                        .addComponent(btnDepartmentShowDomains)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnDepartmentShowEmployees)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnDepartmentShowProjects)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pDepartmentLayout.setVerticalGroup(
            pDepartmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pDepartmentLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(spDepartmentList, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pDepartmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnDeptDel)
                    .addComponent(btnDeptNew)
                    .addComponent(btnDeptSave))
                .addGap(18, 18, 18)
                .addGroup(pDepartmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDeptName)
                    .addComponent(lblDeptLead))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pDepartmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfDepartmentName, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbDeptLead, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblDeptNameError)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 188, Short.MAX_VALUE)
                .addGroup(pDepartmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnDepartmentShowDomains)
                    .addComponent(btnDepartmentShowEmployees)
                    .addComponent(btnDepartmentShowProjects))
                .addContainerGap())
        );

        tpMainContent.addTab(resourceMap.getString("pDepartment.TabConstraints.tabTitle"), pDepartment); // NOI18N

        pDomain.setName("pDomain"); // NOI18N
        pDomain.setPreferredSize(new java.awt.Dimension(800, 600));

        spDomainList.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        spDomainList.setName("spDomainList"); // NOI18N
        spDomainList.setPreferredSize(new java.awt.Dimension(702, 250));

        tDomains.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Domain Name", "Department", "Leader"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tDomains.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
        tDomains.setFillsViewportHeight(true);
        tDomains.setFocusCycleRoot(true);
        tDomains.setMaximumSize(new java.awt.Dimension(702, 32000));
        tDomains.setMinimumSize(new java.awt.Dimension(702, 80));
        tDomains.setName("tDomains"); // NOI18N
        tDomains.setPreferredSize(new java.awt.Dimension(702, 80));
        tDomains.setShowHorizontalLines(false);
        tDomains.setShowVerticalLines(false);
        tDomains.getTableHeader().setReorderingAllowed(false);
        this.tDomains.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        this.tDomains.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
            public void valueChanged(ListSelectionEvent e){
                tDomains_valueChanged(e);
            }
        });
        spDomainList.setViewportView(tDomains);

        btnDomDel.setAction(actionMap.get("btnDomDel_click")); // NOI18N
        btnDomDel.setText(resourceMap.getString("btnDomDel.text")); // NOI18N
        btnDomDel.setName("btnDomDel"); // NOI18N

        btnDomNew.setAction(actionMap.get("btnDomNew_click")); // NOI18N
        btnDomNew.setText(resourceMap.getString("btnDomNew.text")); // NOI18N
        btnDomNew.setName("btnDomNew"); // NOI18N

        btnDomSave.setAction(actionMap.get("btnDomSave_click")); // NOI18N
        btnDomSave.setText(resourceMap.getString("btnDomSave.text")); // NOI18N
        btnDomSave.setName("btnDomSave"); // NOI18N

        tfDomainName.setFont(resourceMap.getFont("tfDomainName.font")); // NOI18N
        tfDomainName.setText(resourceMap.getString("tfDomainName.text")); // NOI18N
        tfDomainName.setName("tfDomainName"); // NOI18N

        lblDomainName.setFont(resourceMap.getFont("lblDomainName.font")); // NOI18N
        lblDomainName.setLabelFor(tfDomainName);
        lblDomainName.setText(resourceMap.getString("lblDomainName.text")); // NOI18N
        lblDomainName.setName("lblDomainName"); // NOI18N

        lblDomainNameError.setForeground(resourceMap.getColor("lblDomainNameError.foreground")); // NOI18N
        lblDomainNameError.setText(resourceMap.getString("lblDomainNameError.text")); // NOI18N
        lblDomainNameError.setName("lblDomainNameError"); // NOI18N

        cbDomainDept.setName("cbDomainDept"); // NOI18N

        lblDomainDept.setFont(resourceMap.getFont("lblDomainDept.font")); // NOI18N
        lblDomainDept.setLabelFor(cbDomainDept);
        lblDomainDept.setText(resourceMap.getString("lblDomainDept.text")); // NOI18N
        lblDomainDept.setName("lblDomainDept"); // NOI18N

        cbDomainLead.setName("cbDomainLead"); // NOI18N

        lblDomainLead.setFont(resourceMap.getFont("lblDomainLead.font")); // NOI18N
        lblDomainLead.setLabelFor(cbDomainLead);
        lblDomainLead.setText(resourceMap.getString("lblDomainLead.text")); // NOI18N
        lblDomainLead.setName("lblDomainLead"); // NOI18N

        btnDomainShowSpecialists.setAction(actionMap.get("btnDomainShowSpecialists")); // NOI18N
        btnDomainShowSpecialists.setText(resourceMap.getString("btnDomainShowSpecialists.text")); // NOI18N
        btnDomainShowSpecialists.setName("btnDomainShowSpecialists"); // NOI18N

        btnDomainShowSubprojects.setAction(actionMap.get("btnDomainShowSubprojects")); // NOI18N
        btnDomainShowSubprojects.setText(resourceMap.getString("btnDomainShowSubprojects.text")); // NOI18N
        btnDomainShowSubprojects.setName("btnDomainShowSubprojects"); // NOI18N

        javax.swing.GroupLayout pDomainLayout = new javax.swing.GroupLayout(pDomain);
        pDomain.setLayout(pDomainLayout);
        pDomainLayout.setHorizontalGroup(
            pDomainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pDomainLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pDomainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pDomainLayout.createSequentialGroup()
                        .addComponent(btnDomDel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnDomNew)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 485, Short.MAX_VALUE)
                        .addComponent(btnDomSave))
                    .addComponent(lblDomainNameError)
                    .addGroup(pDomainLayout.createSequentialGroup()
                        .addGroup(pDomainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblDomainName)
                            .addComponent(tfDomainName, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(156, 156, 156)
                        .addGroup(pDomainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cbDomainDept, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblDomainDept)
                            .addComponent(cbDomainLead, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblDomainLead)))
                    .addComponent(spDomainList, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(pDomainLayout.createSequentialGroup()
                        .addComponent(btnDomainShowSpecialists)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnDomainShowSubprojects)))
                .addContainerGap())
        );
        pDomainLayout.setVerticalGroup(
            pDomainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pDomainLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(spDomainList, javax.swing.GroupLayout.DEFAULT_SIZE, 248, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pDomainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnDomDel)
                    .addComponent(btnDomNew)
                    .addComponent(btnDomSave))
                .addGap(49, 49, 49)
                .addGroup(pDomainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDomainName)
                    .addComponent(lblDomainDept))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pDomainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfDomainName, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbDomainDept, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblDomainNameError)
                .addGap(41, 41, 41)
                .addComponent(lblDomainLead)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cbDomainLead, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 66, Short.MAX_VALUE)
                .addGroup(pDomainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnDomainShowSpecialists)
                    .addComponent(btnDomainShowSubprojects))
                .addContainerGap())
        );

        tpMainContent.addTab(resourceMap.getString("pDomain.TabConstraints.tabTitle"), pDomain); // NOI18N

        pEmployee.setName("pEmployee"); // NOI18N

        spEmployeeList.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        spEmployeeList.setName("spEmployeeList"); // NOI18N
        spEmployeeList.setPreferredSize(new java.awt.Dimension(702, 250));

        tEmployees.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Employee Name", "Department"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tEmployees.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
        tEmployees.setFillsViewportHeight(true);
        tEmployees.setFocusCycleRoot(true);
        tEmployees.setMaximumSize(new java.awt.Dimension(702, 32000));
        tEmployees.setMinimumSize(new java.awt.Dimension(702, 80));
        tEmployees.setName("tEmployees"); // NOI18N
        tEmployees.setPreferredSize(new java.awt.Dimension(702, 80));
        tEmployees.setShowHorizontalLines(false);
        tEmployees.setShowVerticalLines(false);
        tEmployees.getTableHeader().setReorderingAllowed(false);
        this.tEmployees.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        this.tEmployees.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
            public void valueChanged(ListSelectionEvent e){
                tEmployees_valueChanged(e);
            }
        });
        spEmployeeList.setViewportView(tEmployees);

        btnEmployeeDelete.setAction(actionMap.get("btnEmployeeDelete_click")); // NOI18N
        btnEmployeeDelete.setText(resourceMap.getString("btnEmployeeDelete.text")); // NOI18N
        btnEmployeeDelete.setName("btnEmployeeDelete"); // NOI18N

        btnEmployeeNew.setAction(actionMap.get("btnEmployeeNew_click")); // NOI18N
        btnEmployeeNew.setText(resourceMap.getString("btnEmployeeNew.text")); // NOI18N
        btnEmployeeNew.setName("btnEmployeeNew"); // NOI18N

        btnEmployeeSave.setAction(actionMap.get("btnEmployeeSave_click")); // NOI18N
        btnEmployeeSave.setText(resourceMap.getString("btnEmployeeSave.text")); // NOI18N
        btnEmployeeSave.setName("btnEmployeeSave"); // NOI18N

        lblEmployeeFirstname.setFont(resourceMap.getFont("lblEmployeeDept.font")); // NOI18N
        lblEmployeeFirstname.setText(resourceMap.getString("lblEmployeeFirstname.text")); // NOI18N
        lblEmployeeFirstname.setName("lblEmployeeFirstname"); // NOI18N

        tfEmployeeFName.setText(resourceMap.getString("tfEmployeeFName.text")); // NOI18N
        tfEmployeeFName.setName("tfEmployeeFName"); // NOI18N

        lblEmployeeSurname.setFont(resourceMap.getFont("lblEmployeeDept.font")); // NOI18N
        lblEmployeeSurname.setText(resourceMap.getString("lblEmployeeSurname.text")); // NOI18N
        lblEmployeeSurname.setName("lblEmployeeSurname"); // NOI18N

        tfEmployeeSurname.setText(resourceMap.getString("tfEmployeeSurname.text")); // NOI18N
        tfEmployeeSurname.setName("tfEmployeeSurname"); // NOI18N

        lblEmployeeSSN.setFont(resourceMap.getFont("lblEmployeeDept.font")); // NOI18N
        lblEmployeeSSN.setText(resourceMap.getString("lblEmployeeSSN.text")); // NOI18N
        lblEmployeeSSN.setName("lblEmployeeSSN"); // NOI18N

        tfEmployeeSSN.setFont(resourceMap.getFont("tfEmployeeSSN.font")); // NOI18N
        tfEmployeeSSN.setText(resourceMap.getString("tfEmployeeSSN.text")); // NOI18N
        tfEmployeeSSN.setName("tfEmployeeSSN"); // NOI18N

        lblEmployeeDept.setFont(resourceMap.getFont("lblEmployeeDept.font")); // NOI18N
        lblEmployeeDept.setText(resourceMap.getString("lblEmployeeDept.text")); // NOI18N
        lblEmployeeDept.setName("lblEmployeeDept"); // NOI18N

        cbEmployeeDept.setFont(resourceMap.getFont("cbEmployeeDept.font")); // NOI18N
        cbEmployeeDept.setName("cbEmployeeDept"); // NOI18N

        lblEmployeeFNameErr.setForeground(resourceMap.getColor("lblEmployeeFNameErr.foreground")); // NOI18N
        lblEmployeeFNameErr.setText(resourceMap.getString("lblEmployeeSSNErr.text")); // NOI18N
        lblEmployeeFNameErr.setName("lblEmployeeFNameErr"); // NOI18N

        lblEmployeeSNameErr.setForeground(resourceMap.getColor("lblEmployeeSNameErr.foreground")); // NOI18N
        lblEmployeeSNameErr.setText(resourceMap.getString("lblEmployeeSSNErr.text")); // NOI18N
        lblEmployeeSNameErr.setName("lblEmployeeSNameErr"); // NOI18N

        lblEmployeeSSNErr.setForeground(resourceMap.getColor("lblEmployeeSSNErr.foreground")); // NOI18N
        lblEmployeeSSNErr.setText(resourceMap.getString("lblEmployeeSSNErr.text")); // NOI18N
        lblEmployeeSSNErr.setName("lblEmployeeSSNErr"); // NOI18N

        btnEmployeeShowSpecialities.setAction(actionMap.get("btnEmployeeShowDomains_click")); // NOI18N
        btnEmployeeShowSpecialities.setText(resourceMap.getString("btnEmployeeShowSpecialities.text")); // NOI18N
        btnEmployeeShowSpecialities.setName("btnEmployeeShowSpecialities"); // NOI18N

        btnEmployeeShowSubprojects.setAction(actionMap.get("btnEmployeeShowSubprojects_click")); // NOI18N
        btnEmployeeShowSubprojects.setText(resourceMap.getString("btnEmployeeShowSubprojects.text")); // NOI18N
        btnEmployeeShowSubprojects.setName("btnEmployeeShowSubprojects"); // NOI18N

        btnEmployeeEditLevels.setAction(actionMap.get("btnEmployeeEditLevels_click")); // NOI18N
        btnEmployeeEditLevels.setText(resourceMap.getString("btnEmployeeEditLevels.text")); // NOI18N
        btnEmployeeEditLevels.setName("btnEmployeeEditLevels"); // NOI18N

        javax.swing.GroupLayout pEmployeeLayout = new javax.swing.GroupLayout(pEmployee);
        pEmployee.setLayout(pEmployeeLayout);
        pEmployeeLayout.setHorizontalGroup(
            pEmployeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pEmployeeLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pEmployeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pEmployeeLayout.createSequentialGroup()
                        .addGroup(pEmployeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblEmployeeFirstname)
                            .addGroup(pEmployeeLayout.createSequentialGroup()
                                .addGroup(pEmployeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblEmployeeSSN, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(pEmployeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(tfEmployeeSSN, javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(tfEmployeeFName, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE))
                                    .addComponent(lblEmployeeFNameErr))
                                .addGap(179, 179, 179)
                                .addGroup(pEmployeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblEmployeeSNameErr)
                                    .addComponent(cbEmployeeDept, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblEmployeeSurname)
                                    .addComponent(tfEmployeeSurname, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblEmployeeDept)))
                            .addComponent(lblEmployeeSSNErr)
                            .addGroup(pEmployeeLayout.createSequentialGroup()
                                .addComponent(btnEmployeeShowSpecialities)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnEmployeeShowSubprojects)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 275, Short.MAX_VALUE)
                                .addComponent(btnEmployeeEditLevels))
                            .addComponent(spEmployeeList, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(10, 10, 10))
                    .addGroup(pEmployeeLayout.createSequentialGroup()
                        .addComponent(btnEmployeeDelete)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnEmployeeNew)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 473, Short.MAX_VALUE)
                        .addComponent(btnEmployeeSave)
                        .addContainerGap())))
        );
        pEmployeeLayout.setVerticalGroup(
            pEmployeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pEmployeeLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(spEmployeeList, javax.swing.GroupLayout.DEFAULT_SIZE, 247, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pEmployeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnEmployeeDelete)
                    .addComponent(btnEmployeeNew)
                    .addComponent(btnEmployeeSave))
                .addGap(46, 46, 46)
                .addGroup(pEmployeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblEmployeeFirstname)
                    .addComponent(lblEmployeeSurname))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pEmployeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfEmployeeFName, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfEmployeeSurname, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pEmployeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblEmployeeFNameErr)
                    .addComponent(lblEmployeeSNameErr))
                .addGap(41, 41, 41)
                .addGroup(pEmployeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblEmployeeSSN)
                    .addComponent(lblEmployeeDept))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pEmployeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfEmployeeSSN, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbEmployeeDept, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblEmployeeSSNErr)
                .addGap(68, 68, 68)
                .addGroup(pEmployeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnEmployeeShowSpecialities)
                    .addComponent(btnEmployeeShowSubprojects)
                    .addComponent(btnEmployeeEditLevels))
                .addContainerGap())
        );

        tpMainContent.addTab(resourceMap.getString("pEmployee.TabConstraints.tabTitle"), pEmployee); // NOI18N

        pGame.setName("pGame"); // NOI18N
        pGame.setPreferredSize(new java.awt.Dimension(702, 577));

        spGameList.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        spGameList.setName("spGameList"); // NOI18N
        spGameList.setPreferredSize(new java.awt.Dimension(702, 250));

        tGames.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Game Name", "Start Date", "Deadline", "Leader"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tGames.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
        tGames.setFillsViewportHeight(true);
        tGames.setFocusCycleRoot(true);
        tGames.setMaximumSize(new java.awt.Dimension(702, 32000));
        tGames.setMinimumSize(new java.awt.Dimension(702, 80));
        tGames.setName("tGames"); // NOI18N
        tGames.setPreferredSize(new java.awt.Dimension(702, 80));
        tGames.setShowHorizontalLines(false);
        tGames.setShowVerticalLines(false);
        tGames.getTableHeader().setReorderingAllowed(false);
        this.tGames.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        this.tGames.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
            public void valueChanged(ListSelectionEvent e){
                tGames_valueChanged(e);
            }
        });
        spGameList.setViewportView(tGames);

        btnGameDelete.setAction(actionMap.get("btnGameDelete_click")); // NOI18N
        btnGameDelete.setText(resourceMap.getString("btnGameDelete.text")); // NOI18N
        btnGameDelete.setName("btnGameDelete"); // NOI18N

        btnGameNew.setAction(actionMap.get("btnGameNew_click")); // NOI18N
        btnGameNew.setText(resourceMap.getString("btnGameNew.text")); // NOI18N
        btnGameNew.setName("btnGameNew"); // NOI18N

        btnGameSave.setAction(actionMap.get("btnGameSave_click")); // NOI18N
        btnGameSave.setText(resourceMap.getString("btnGameSave.text")); // NOI18N
        btnGameSave.setName("btnGameSave"); // NOI18N

        lblGameName.setFont(resourceMap.getFont("lblGameName.font")); // NOI18N
        lblGameName.setText(resourceMap.getString("lblGameName.text")); // NOI18N
        lblGameName.setName("lblGameName"); // NOI18N

        tfGameName.setFont(resourceMap.getFont("tfGameName.font")); // NOI18N
        tfGameName.setText(resourceMap.getString("tfGameName.text")); // NOI18N
        tfGameName.setName("tfGameName"); // NOI18N

        lblGameStart.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        lblGameStart.setText(resourceMap.getString("lblGameStart.text")); // NOI18N
        lblGameStart.setName("lblGameStart"); // NOI18N

        lblGameDeadline.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        lblGameDeadline.setText(resourceMap.getString("lblGameDeadline.text")); // NOI18N
        lblGameDeadline.setName("lblGameDeadline"); // NOI18N

        tfGameStart.setFont(resourceMap.getFont("jTextField1.font")); // NOI18N
        tfGameStart.setText(resourceMap.getString("tfGameStart.text")); // NOI18N
        tfGameStart.setName("tfGameStart"); // NOI18N

        tfGameDeadline.setFont(resourceMap.getFont("jTextField1.font")); // NOI18N
        tfGameDeadline.setText(resourceMap.getString("tfGameDeadline.text")); // NOI18N
        tfGameDeadline.setName("tfGameDeadline"); // NOI18N

        lblGameLeader.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        lblGameLeader.setText(resourceMap.getString("lblGameLeader.text")); // NOI18N
        lblGameLeader.setName("lblGameLeader"); // NOI18N

        cbGameLead.setFont(resourceMap.getFont("cbGameLead.font")); // NOI18N
        cbGameLead.setName("cbGameLead"); // NOI18N

        btnGameShowProjects.setAction(actionMap.get("btnGameShowProjects_click")); // NOI18N
        btnGameShowProjects.setText(resourceMap.getString("btnGameShowProjects.text")); // NOI18N
        btnGameShowProjects.setName("btnGameShowProjects"); // NOI18N

        btnGameShowEmployees.setAction(actionMap.get("btnGameShowEmployees_click")); // NOI18N
        btnGameShowEmployees.setText(resourceMap.getString("btnGameShowEmployees.text")); // NOI18N
        btnGameShowEmployees.setName("btnGameShowEmployees"); // NOI18N

        lblGameNameError.setForeground(resourceMap.getColor("lblGameNameError.foreground")); // NOI18N
        lblGameNameError.setText(resourceMap.getString("lblGameNameError.text")); // NOI18N
        lblGameNameError.setName("lblGameNameError"); // NOI18N

        lblGameStartError.setForeground(resourceMap.getColor("lblGameStartError.foreground")); // NOI18N
        lblGameStartError.setText(resourceMap.getString("lblGameStartError.text")); // NOI18N
        lblGameStartError.setName("lblGameStartError"); // NOI18N

        lblGameDeadlineError.setForeground(resourceMap.getColor("lblGameDeadlineError.foreground")); // NOI18N
        lblGameDeadlineError.setText(resourceMap.getString("lblGameDeadlineError.text")); // NOI18N
        lblGameDeadlineError.setName("lblGameDeadlineError"); // NOI18N

        btnGameShowInDev.setAction(actionMap.get("btnGameShowInDev_click")); // NOI18N
        btnGameShowInDev.setText(resourceMap.getString("btnGameShowInDev.text")); // NOI18N
        btnGameShowInDev.setName("btnGameShowInDev"); // NOI18N

        javax.swing.GroupLayout pGameLayout = new javax.swing.GroupLayout(pGame);
        pGame.setLayout(pGameLayout);
        pGameLayout.setHorizontalGroup(
            pGameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pGameLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pGameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(spGameList, javax.swing.GroupLayout.DEFAULT_SIZE, 702, Short.MAX_VALUE)
                    .addComponent(lblGameDeadline)
                    .addComponent(tfGameDeadline, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblGameDeadlineError)
                    .addGroup(pGameLayout.createSequentialGroup()
                        .addComponent(btnGameShowProjects)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnGameShowEmployees)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnGameShowInDev))
                    .addGroup(pGameLayout.createSequentialGroup()
                        .addComponent(btnGameDelete)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnGameNew)
                        .addGap(493, 493, 493)
                        .addComponent(btnGameSave))
                    .addGroup(pGameLayout.createSequentialGroup()
                        .addGroup(pGameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tfGameName, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblGameNameError)
                            .addComponent(lblGameName))
                        .addGroup(pGameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pGameLayout.createSequentialGroup()
                                .addGap(295, 295, 295)
                                .addComponent(lblGameStartError))
                            .addGroup(pGameLayout.createSequentialGroup()
                                .addGap(162, 162, 162)
                                .addGroup(pGameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(tfGameStart, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblGameStart)
                                    .addComponent(cbGameLead, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblGameLeader))))))
                .addContainerGap())
        );
        pGameLayout.setVerticalGroup(
            pGameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pGameLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(spGameList, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pGameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pGameLayout.createSequentialGroup()
                        .addGroup(pGameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnGameDelete)
                            .addComponent(btnGameNew))
                        .addGap(31, 31, 31)
                        .addGroup(pGameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblGameName)
                            .addComponent(lblGameStart))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pGameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tfGameName, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfGameStart, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pGameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblGameNameError)
                            .addComponent(lblGameStartError))
                        .addGap(40, 40, 40)
                        .addGroup(pGameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblGameDeadline)
                            .addComponent(lblGameLeader))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pGameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tfGameDeadline, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cbGameLead, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblGameDeadlineError)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 81, Short.MAX_VALUE)
                        .addGroup(pGameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnGameShowProjects)
                            .addComponent(btnGameShowEmployees)
                            .addComponent(btnGameShowInDev)))
                    .addComponent(btnGameSave))
                .addContainerGap())
        );

        tpMainContent.addTab(resourceMap.getString("pGame.TabConstraints.tabTitle"), pGame); // NOI18N

        pProject.setName("pProject"); // NOI18N

        spProjectList.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        spProjectList.setName("spProjectList"); // NOI18N
        spProjectList.setPreferredSize(new java.awt.Dimension(702, 250));

        tProjects.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Project Name", "Leader", "Department", "Game"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tProjects.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
        tProjects.setFillsViewportHeight(true);
        tProjects.setFocusCycleRoot(true);
        tProjects.setMaximumSize(new java.awt.Dimension(702, 32000));
        tProjects.setMinimumSize(new java.awt.Dimension(702, 80));
        tProjects.setName("tProjects"); // NOI18N
        tProjects.setPreferredSize(new java.awt.Dimension(702, 80));
        tProjects.setShowHorizontalLines(false);
        tProjects.setShowVerticalLines(false);
        tProjects.getTableHeader().setReorderingAllowed(false);
        this.tProjects.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        this.tProjects.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
            public void valueChanged(ListSelectionEvent e){
                tProjects_valueChanged(e);
            }
        });
        spProjectList.setViewportView(tProjects);
        tProjects.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("tProjects.columnModel.title0")); // NOI18N
        tProjects.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("tProjects.columnModel.title1")); // NOI18N
        tProjects.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("tProjects.columnModel.title2")); // NOI18N
        tProjects.getColumnModel().getColumn(3).setHeaderValue(resourceMap.getString("tProjects.columnModel.title3")); // NOI18N

        btnProjectDelete.setAction(actionMap.get("btnProjectDelete_click")); // NOI18N
        btnProjectDelete.setText(resourceMap.getString("btnProjectDelete.text")); // NOI18N
        btnProjectDelete.setName("btnProjectDelete"); // NOI18N

        btnProjectNew.setAction(actionMap.get("btnProjectNew_click")); // NOI18N
        btnProjectNew.setText(resourceMap.getString("btnProjectNew.text")); // NOI18N
        btnProjectNew.setName("btnProjectNew"); // NOI18N

        btnProjectSave.setAction(actionMap.get("btnProjectSave_click")); // NOI18N
        btnProjectSave.setText(resourceMap.getString("btnProjectSave.text")); // NOI18N
        btnProjectSave.setName("btnProjectSave"); // NOI18N

        lblProjectName.setFont(resourceMap.getFont("lblProjectName.font")); // NOI18N
        lblProjectName.setText(resourceMap.getString("lblProjectName.text")); // NOI18N
        lblProjectName.setName("lblProjectName"); // NOI18N

        tfProjectName.setFont(resourceMap.getFont("jComboBox3.font")); // NOI18N
        tfProjectName.setText(resourceMap.getString("tfProjectName.text")); // NOI18N
        tfProjectName.setName("tfProjectName"); // NOI18N

        lblProjectLead.setFont(resourceMap.getFont("jLabel4.font")); // NOI18N
        lblProjectLead.setText(resourceMap.getString("lblProjectLead.text")); // NOI18N
        lblProjectLead.setName("lblProjectLead"); // NOI18N

        cbProjectLead.setFont(resourceMap.getFont("jComboBox3.font")); // NOI18N
        cbProjectLead.setName("cbProjectLead"); // NOI18N

        lblProjectDept.setFont(resourceMap.getFont("lblProjectDept.font")); // NOI18N
        lblProjectDept.setText(resourceMap.getString("lblProjectDept.text")); // NOI18N
        lblProjectDept.setName("lblProjectDept"); // NOI18N

        cbProjectDept.setFont(resourceMap.getFont("jComboBox3.font")); // NOI18N
        cbProjectDept.setName("cbProjectDept"); // NOI18N

        lblProjectGame.setFont(resourceMap.getFont("lblProjectGame.font")); // NOI18N
        lblProjectGame.setText(resourceMap.getString("lblProjectGame.text")); // NOI18N
        lblProjectGame.setName("lblProjectGame"); // NOI18N

        cbProjectGame.setFont(resourceMap.getFont("cbProjectGame.font")); // NOI18N
        cbProjectGame.setName("cbProjectGame"); // NOI18N

        lblProjectDesc.setFont(resourceMap.getFont("lblProjectDesc.font")); // NOI18N
        lblProjectDesc.setText(resourceMap.getString("lblProjectDesc.text")); // NOI18N
        lblProjectDesc.setName("lblProjectDesc"); // NOI18N

        spProjectDesc.setName("spProjectDesc"); // NOI18N

        taProjectDesc.setColumns(20);
        taProjectDesc.setFont(resourceMap.getFont("jComboBox3.font")); // NOI18N
        taProjectDesc.setRows(5);
        taProjectDesc.setName("taProjectDesc"); // NOI18N
        spProjectDesc.setViewportView(taProjectDesc);

        btnProjectShowSubprojects.setAction(actionMap.get("btnProjectShowSubprojects_click")); // NOI18N
        btnProjectShowSubprojects.setText(resourceMap.getString("btnProjectShowSubprojects.text")); // NOI18N
        btnProjectShowSubprojects.setName("btnProjectShowSubprojects"); // NOI18N

        btnProjectShowDev.setAction(actionMap.get("btnProjectShowDev_click")); // NOI18N
        btnProjectShowDev.setText(resourceMap.getString("btnProjectShowDev.text")); // NOI18N
        btnProjectShowDev.setName("btnProjectShowDev"); // NOI18N

        lblProjectNameError.setForeground(resourceMap.getColor("lblProjectNameError.foreground")); // NOI18N
        lblProjectNameError.setText(resourceMap.getString("lblProjectNameError.text")); // NOI18N
        lblProjectNameError.setName("lblProjectNameError"); // NOI18N

        javax.swing.GroupLayout pProjectLayout = new javax.swing.GroupLayout(pProject);
        pProject.setLayout(pProjectLayout);
        pProjectLayout.setHorizontalGroup(
            pProjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pProjectLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pProjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pProjectLayout.createSequentialGroup()
                        .addComponent(spProjectDesc, javax.swing.GroupLayout.DEFAULT_SIZE, 702, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(pProjectLayout.createSequentialGroup()
                        .addGroup(pProjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblProjectName)
                            .addComponent(tfProjectName, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(139, 139, 139)
                        .addGroup(pProjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cbProjectLead, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblProjectLead))
                        .addGap(173, 173, 173))
                    .addGroup(pProjectLayout.createSequentialGroup()
                        .addComponent(btnProjectShowSubprojects)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnProjectShowDev)
                        .addContainerGap(410, Short.MAX_VALUE))
                    .addGroup(pProjectLayout.createSequentialGroup()
                        .addComponent(btnProjectDelete)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnProjectNew)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 485, Short.MAX_VALUE)
                        .addComponent(btnProjectSave)
                        .addContainerGap())
                    .addGroup(pProjectLayout.createSequentialGroup()
                        .addComponent(spProjectList, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(pProjectLayout.createSequentialGroup()
                        .addComponent(lblProjectNameError)
                        .addContainerGap(712, Short.MAX_VALUE))
                    .addGroup(pProjectLayout.createSequentialGroup()
                        .addGroup(pProjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pProjectLayout.createSequentialGroup()
                                .addGap(339, 339, 339)
                                .addGroup(pProjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblProjectGame)
                                    .addComponent(cbProjectGame, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(163, 163, 163))
                            .addComponent(cbProjectDept, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(pProjectLayout.createSequentialGroup()
                                .addComponent(lblProjectDept)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 465, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(pProjectLayout.createSequentialGroup()
                                .addComponent(lblProjectDesc)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 471, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap())))
        );
        pProjectLayout.setVerticalGroup(
            pProjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pProjectLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(spProjectList, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pProjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnProjectDelete)
                    .addComponent(btnProjectNew)
                    .addComponent(btnProjectSave))
                .addGap(18, 18, 18)
                .addGroup(pProjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblProjectName)
                    .addComponent(lblProjectLead))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pProjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfProjectName, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbProjectLead, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblProjectNameError)
                .addGap(24, 24, 24)
                .addGroup(pProjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblProjectDept)
                    .addComponent(lblProjectGame))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pProjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbProjectDept, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbProjectGame, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(lblProjectDesc)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(spProjectDesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(pProjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnProjectShowSubprojects)
                    .addComponent(btnProjectShowDev))
                .addContainerGap())
        );

        tpMainContent.addTab(resourceMap.getString("pProject.TabConstraints.tabTitle"), pProject); // NOI18N

        pSubproject.setName("pSubproject"); // NOI18N

        spSubprojectList.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        spSubprojectList.setName("spSubprojectList"); // NOI18N
        spSubprojectList.setPreferredSize(new java.awt.Dimension(702, 250));

        tSubprojects.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Subproject Name", "Leader", "Domain", "Project", "Game"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tSubprojects.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
        tSubprojects.setFillsViewportHeight(true);
        tSubprojects.setFocusCycleRoot(true);
        tSubprojects.setMaximumSize(new java.awt.Dimension(702, 32000));
        tSubprojects.setMinimumSize(new java.awt.Dimension(702, 80));
        tSubprojects.setName("tSubprojects"); // NOI18N
        tSubprojects.setPreferredSize(new java.awt.Dimension(702, 80));
        tSubprojects.setShowHorizontalLines(false);
        tSubprojects.setShowVerticalLines(false);
        tSubprojects.getTableHeader().setReorderingAllowed(false);
        this.tSubprojects.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        this.tSubprojects.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
            public void valueChanged(ListSelectionEvent e){
                tSubprojects_valueChanged(e);
            }
        });
        spSubprojectList.setViewportView(tSubprojects);

        btnSubprojectDelete.setAction(actionMap.get("btnSubprojectDelete_click")); // NOI18N
        btnSubprojectDelete.setText(resourceMap.getString("btnSubprojectDelete.text")); // NOI18N
        btnSubprojectDelete.setName("btnSubprojectDelete"); // NOI18N

        btnSubprojectNew.setAction(actionMap.get("btnSubprojectNew_click")); // NOI18N
        btnSubprojectNew.setText(resourceMap.getString("btnSubprojectNew.text")); // NOI18N
        btnSubprojectNew.setName("btnSubprojectNew"); // NOI18N

        btnSubprojectSave.setAction(actionMap.get("btnSubprojectSave_click")); // NOI18N
        btnSubprojectSave.setText(resourceMap.getString("btnSubprojectSave.text")); // NOI18N
        btnSubprojectSave.setName("btnSubprojectSave"); // NOI18N

        lblSubprojectName.setFont(resourceMap.getFont("lblSubprojectName.font")); // NOI18N
        lblSubprojectName.setText(resourceMap.getString("lblSubprojectName.text")); // NOI18N
        lblSubprojectName.setName("lblSubprojectName"); // NOI18N

        tfSubprojectName.setText(resourceMap.getString("tfSubprojectName.text")); // NOI18N
        tfSubprojectName.setName("tfSubprojectName"); // NOI18N

        lblSubprojectLead.setFont(resourceMap.getFont("lblSubprojectLead.font")); // NOI18N
        lblSubprojectLead.setText(resourceMap.getString("lblSubprojectLead.text")); // NOI18N
        lblSubprojectLead.setName("lblSubprojectLead"); // NOI18N

        cbSubprojectLead.setFont(resourceMap.getFont("cbSubprojectLead.font")); // NOI18N
        cbSubprojectLead.setName("cbSubprojectLead"); // NOI18N

        lblSubprojectDomain.setFont(resourceMap.getFont("lblSubprojectDomain.font")); // NOI18N
        lblSubprojectDomain.setText(resourceMap.getString("lblSubprojectDomain.text")); // NOI18N
        lblSubprojectDomain.setName("lblSubprojectDomain"); // NOI18N

        cbSubprojectDomain.setName("cbSubprojectDomain"); // NOI18N

        lblSubprojectProject.setFont(resourceMap.getFont("lblSubprojectProject.font")); // NOI18N
        lblSubprojectProject.setText(resourceMap.getString("lblSubprojectProject.text")); // NOI18N
        lblSubprojectProject.setName("lblSubprojectProject"); // NOI18N

        cbSubprojectProject.setName("cbSubprojectProject"); // NOI18N

        lblSubprojectDescription.setFont(resourceMap.getFont("lblSubprojectDescription.font")); // NOI18N
        lblSubprojectDescription.setText(resourceMap.getString("lblSubprojectDescription.text")); // NOI18N
        lblSubprojectDescription.setName("lblSubprojectDescription"); // NOI18N

        spSubprojectDesc.setName("spSubprojectDesc"); // NOI18N

        taSubprojectDesc.setColumns(20);
        taSubprojectDesc.setLineWrap(true);
        taSubprojectDesc.setRows(5);
        taSubprojectDesc.setWrapStyleWord(true);
        taSubprojectDesc.setName("taSubprojectDesc"); // NOI18N
        spSubprojectDesc.setViewportView(taSubprojectDesc);

        btnSubprojectShowEmployees.setAction(actionMap.get("btnSubprojectShowEmployees_click")); // NOI18N
        btnSubprojectShowEmployees.setText(resourceMap.getString("btnSubprojectShowEmployees.text")); // NOI18N
        btnSubprojectShowEmployees.setName("btnSubprojectShowEmployees"); // NOI18N

        lblSubprojectNameError.setForeground(resourceMap.getColor("lblSubprojectNameError.foreground")); // NOI18N
        lblSubprojectNameError.setText(resourceMap.getString("lblSubprojectNameError.text")); // NOI18N
        lblSubprojectNameError.setName("lblSubprojectNameError"); // NOI18N

        javax.swing.GroupLayout pSubprojectLayout = new javax.swing.GroupLayout(pSubproject);
        pSubproject.setLayout(pSubprojectLayout);
        pSubprojectLayout.setHorizontalGroup(
            pSubprojectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pSubprojectLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pSubprojectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(spSubprojectList, javax.swing.GroupLayout.DEFAULT_SIZE, 702, Short.MAX_VALUE)
                    .addGroup(pSubprojectLayout.createSequentialGroup()
                        .addComponent(btnSubprojectDelete)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnSubprojectNew)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 467, Short.MAX_VALUE)
                        .addComponent(btnSubprojectSave))
                    .addGroup(pSubprojectLayout.createSequentialGroup()
                        .addGroup(pSubprojectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblSubprojectName)
                            .addComponent(tfSubprojectName, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(157, 157, 157)
                        .addGroup(pSubprojectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cbSubprojectLead, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSubprojectLead)))
                    .addComponent(btnSubprojectShowEmployees)
                    .addComponent(spSubprojectDesc, javax.swing.GroupLayout.DEFAULT_SIZE, 702, Short.MAX_VALUE)
                    .addGroup(pSubprojectLayout.createSequentialGroup()
                        .addGroup(pSubprojectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cbSubprojectDomain, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSubprojectDomain))
                        .addGap(157, 157, 157)
                        .addGroup(pSubprojectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cbSubprojectProject, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSubprojectProject)))
                    .addComponent(lblSubprojectDescription)
                    .addComponent(lblSubprojectNameError))
                .addContainerGap())
        );
        pSubprojectLayout.setVerticalGroup(
            pSubprojectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pSubprojectLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(spSubprojectList, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pSubprojectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnSubprojectDelete)
                    .addComponent(btnSubprojectNew)
                    .addComponent(btnSubprojectSave))
                .addGap(18, 18, 18)
                .addGroup(pSubprojectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblSubprojectName)
                    .addComponent(lblSubprojectLead))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pSubprojectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfSubprojectName, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbSubprojectLead, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblSubprojectNameError)
                .addGap(12, 12, 12)
                .addGroup(pSubprojectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblSubprojectDomain)
                    .addComponent(lblSubprojectProject))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pSubprojectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbSubprojectDomain, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbSubprojectProject, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(lblSubprojectDescription)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(spSubprojectDesc, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnSubprojectShowEmployees)
                .addContainerGap())
        );

        tpMainContent.addTab(resourceMap.getString("pSubproject.TabConstraints.tabTitle"), pSubproject); // NOI18N

        javax.swing.GroupLayout pMainPanelLayout = new javax.swing.GroupLayout(pMainPanel);
        pMainPanel.setLayout(pMainPanelLayout);
        pMainPanelLayout.setHorizontalGroup(
            pMainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tpMainContent, javax.swing.GroupLayout.DEFAULT_SIZE, 800, Short.MAX_VALUE)
        );
        pMainPanelLayout.setVerticalGroup(
            pMainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tpMainContent, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        tpMainContent.getAccessibleContext().setAccessibleName(resourceMap.getString("tpMainContent.AccessibleContext.accessibleName")); // NOI18N

        mbTopMenu.setName("mbTopMenu"); // NOI18N

        mFile.setText(resourceMap.getString("mFile.text")); // NOI18N
        mFile.setName("mFile"); // NOI18N

        miExit.setAction(actionMap.get("quit")); // NOI18N
        miExit.setName("miExit"); // NOI18N
        mFile.add(miExit);

        mbTopMenu.add(mFile);

        mHelp.setText(resourceMap.getString("mHelp.text")); // NOI18N
        mHelp.setName("mHelp"); // NOI18N

        miAbout.setAction(actionMap.get("miAbout_click")); // NOI18N
        miAbout.setText(resourceMap.getString("miAbout.text")); // NOI18N
        miAbout.setName("miAbout"); // NOI18N
        mHelp.add(miAbout);

        mbTopMenu.add(mHelp);

        setComponent(pMainPanel);
        setMenuBar(mbTopMenu);
    }// </editor-fold>//GEN-END:initComponents

    private void tpMainContent_StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_tpMainContent_StateChanged
        JTabbedPane source = (JTabbedPane)evt.getSource();
        Integer nIndex = source.getSelectedIndex();
        
        switch(nIndex){
            case 0:/* Department */
                this.departmentTab_activated();
                break;
            case 1: /* Domain */
                this.domainTab_activated();
                break;
            case 2: /* Employee */
                this.employeeTab_activated();
                break;
            case 3: /* Game */
                this.gameTab_activated();
                break;
            case 4: /* Project */
                this.projectTab_activated();
                break;
            case 5: /* Subproject */
                this.subprojectTab_activated();
                break;
        }
    }//GEN-LAST:event_tpMainContent_StateChanged

    private void departmentTab_activated(){
        DepartmentCollection dc = new DepartmentCollection().load(); 
        EmployeeCollection ec = new EmployeeCollection().load();
        
        DefaultTableModel tm = (DefaultTableModel)this.tDepartments.getModel();
        tm.getDataVector().removeAllElements();
        
        for(Department d : dc){
            tm.addRow(new Object[]{d, ec.getById(d.getLeadId())});
        }
        tm.fireTableStructureChanged();
        
        this.cbDeptLead.removeAllItems();
        for(Employee e : ec){
            this.cbDeptLead.addItem(e);
        }        
        
        this.tDepartments.getSelectionModel().setSelectionInterval(0, 0);
    }
    
    private void tDepartments_valueChanged(ListSelectionEvent e){
        if(!e.getValueIsAdjusting()){
            Integer i = this.tDepartments.getSelectedRow();
            
            try{
                this.deptCurrentObject = (Department)this.tDepartments.getValueAt(i, 0);
            }catch(Exception ex){
                return;
            }
            
            this.tfDepartmentName.setText(this.deptCurrentObject.getName());
            this.cbDeptLead.setSelectedItem(this.deptCurrentObject.getLead());
            
            
        }
    }

    @Action
    public void btnDeptNew_click() {
        this.deptCurrentObject=new Department();
        
        this.tfDepartmentName.setText("");
        this.lblDeptNameError.setText("");
        
        this.cbDeptLead.setSelectedIndex(0);
    }

    @Action
    public void btnDeptSave_click() {
        String nName = this.tfDepartmentName.getText();
        Employee lead = (Employee)this.cbDeptLead.getSelectedItem();
        nName = nName.trim();
                
        String errText = InputValidator.validateDepartmentName(nName);
        
        if(errText==null){
            this.deptCurrentObject.setName(nName);
            this.deptCurrentObject.setLead(lead);
            
            if(this.deptCurrentObject.save()){
                JOptionPane.showMessageDialog(this.getFrame(), "The department was successfully saved.", "Save Successful", JOptionPane.INFORMATION_MESSAGE);
            }else{
                JOptionPane.showMessageDialog(this.getFrame(), "The department could not be saved.", "Save Failed", JOptionPane.ERROR_MESSAGE);
            }
        }else{
            this.lblDeptNameError.setText(errText);
        }
        
        this.departmentTab_activated();
    }

    @Action
    public void btnDeptDel_click() {
        if(this.deptCurrentObject.isNew()){
            this.btnDeptNew_click();
        }else{
            if(this.deptCurrentObject.delete()){
                JOptionPane.showMessageDialog(this.getFrame(), "The selected department was deleted successfully.", "Deletion Successful", JOptionPane.INFORMATION_MESSAGE);
                
                this.departmentTab_activated();
            }else{
                JOptionPane.showMessageDialog(this.getFrame(), "The selected department could not be deleted.", "Deletion Failed", JOptionPane.ERROR_MESSAGE);
            }
        }
    }
    
    @Action
    public void btnDepartmentShowDomains_click(){
        if(this.deptCurrentObject.isNew())return;
        
        DomainCollection dc = this.deptCurrentObject.getDomains();
        if(dc.size()==0)return;
        
        DefaultTableModel tm = new DefaultTableModel(new Object[]{"Domain Name","Leader"},0);
        
        EmployeeCollection ec = new EmployeeCollection().load();
        for(Domain d : dc){
            tm.addRow(new Object[]{d,ec.getById(d.getLeadId())});
        }
        
        SimpleDataView sdv = new SimpleDataView(this.getFrame(), tm);
        sdv.setTitle("Showing all domains for Department: "+this.deptCurrentObject.toString());
        sdv.setVisible(true);
    }
    
    @Action
    public void btnDepartmentShowEmployees_click(){
        if(this.deptCurrentObject.isNew())return;
        
        EmployeeCollection ec = this.deptCurrentObject.getAssignedEmployees();
        if(ec.size()==0)return;
        
        DefaultTableModel tm = new DefaultTableModel(new Object[]{"First Name","Surname","Social Security Number"},0);
        
        for(Employee e : ec){
            tm.addRow(new Object[]{e.getFirstname(), e.getSurname(), e.getSSN()});
        }
        
        SimpleDataView sdv = new SimpleDataView(this.getFrame(), tm);
        sdv.setTitle("Showing all Employees for Department: "+this.deptCurrentObject.toString());
        sdv.setVisible(true);
    }
    
    @Action
    public void btnDepartmentShowProjects_click(){
        if(this.deptCurrentObject.isNew())return;
        
        ProjectCollection pc = this.deptCurrentObject.getProjects();
        if(pc.size()==0)return;
        
        DefaultTableModel tm = new DefaultTableModel(new Object[]{"Project Name","Leader","Game"},0);
        
        EmployeeCollection ec = new EmployeeCollection().load();
        GameCollection gc = new GameCollection().load();
        
        for(Project p : pc){
            tm.addRow(new Object[]{p,ec.getById(p.getLeadId()),gc.getById(p.getGameId())});
        }
        
        SimpleDataView sdv = new SimpleDataView(this.getFrame(), tm);
        sdv.setTitle("Showing all Projects for Department: "+this.deptCurrentObject.toString());
        sdv.setVisible(true);
    }
    
    private void domainTab_activated(){
        DomainCollection dc = new DomainCollection().load();
        DepartmentCollection dtc = new DepartmentCollection().load();
        EmployeeCollection ec = new EmployeeCollection().load();
        
        DefaultTableModel tm = (DefaultTableModel)this.tDomains.getModel();
        tm.getDataVector().removeAllElements();
        
        for(int i=0;i<dc.size();i++){
            Domain d = dc.get(i);
            
            tm.addRow(new Object[]{d, dtc.getById(d.getDepartmentId()), ec.getById(d.getLeadId())});
        }
        
        this.cbDomainDept.removeAllItems();
        for(Department d : dtc){
            this.cbDomainDept.addItem(d);
        }
        this.cbDomainLead.removeAllItems();
        for(Employee e : ec){
            this.cbDomainLead.addItem(e);
        }
        
        tm.fireTableDataChanged();
        
        this.tDomains.getSelectionModel().setSelectionInterval(0,0);
    }
    
    private void tDomains_valueChanged(ListSelectionEvent e){
        Integer i = this.tDomains.getSelectedRow();
        
        try{
            this.domCurrentObject = (Domain)this.tDomains.getValueAt(i, 0);
        }catch(Exception ex){
            return;
        }
        
        this.tfDomainName.setText(this.domCurrentObject.getName());
        this.cbDomainDept.setSelectedItem(this.domCurrentObject.getDepartment());
        this.cbDomainLead.setSelectedItem(this.domCurrentObject.getLead());
    }
    
    @Action
    public void btnDomDel_click(){
        if(!this.domCurrentObject.isNew()){
            if(this.domCurrentObject.delete()){
                this.domainTab_activated();
                
                JOptionPane.showMessageDialog(this.getFrame(), "The selected domain was deleted successfully.", "Deletion Successful", JOptionPane.INFORMATION_MESSAGE);
            }else{
                JOptionPane.showMessageDialog(this.getFrame(), "The selected domain could not be deleted.", "Deletion Failed", JOptionPane.ERROR_MESSAGE);
            }
        }else{
            this.btnDomNew_click();
        }
    }
    
    @Action
    public void btnDomNew_click(){
        this.domCurrentObject=new Domain();
        
        this.tfDomainName.setText("");
        this.lblDomainNameError.setText("");
        this.cbDomainDept.setSelectedIndex(0);
        this.cbDomainLead.setSelectedIndex(0);
    }
    
    @Action
    public void btnDomSave_click(){
        String name = this.tfDomainName.getText(), errText=null;
        name = name.trim();
        
        errText=InputValidator.validateDomainName(name);

        if(errText==null){
            this.domCurrentObject.setName(name);
            this.domCurrentObject.setDepartment((Department)this.cbDomainDept.getSelectedItem());
            this.domCurrentObject.setLead((Employee)this.cbDomainLead.getSelectedItem());

            if(this.domCurrentObject.save()){
                JOptionPane.showMessageDialog(this.getFrame(), "The domain was successfully saved.", "Save Successful", JOptionPane.INFORMATION_MESSAGE);

                this.domainTab_activated();
            }else{
                JOptionPane.showMessageDialog(this.getFrame(), "The domain could not be saved.", "Save Failed", JOptionPane.ERROR_MESSAGE);
            }
        }else{
            this.lblDomainNameError.setText(errText);
        }
    }
    
    @Action
    public void btnDomainShowSpecialists(){
        if(this.domCurrentObject.isNew())return;
        
        EmployeeCollection ec = this.domCurrentObject.getSpecialists();
        if(ec.size()==0)return;
        
        DepartmentCollection dc = new DepartmentCollection().load();
        DefaultTableModel tm = new DefaultTableModel(new Object[]{"First name","Surname","Level","Social Security Number", "Department"},0);
        
        for(Employee e : ec){
            Integer l = e.getSpecialityLevel(this.domCurrentObject);
            tm.addRow(new Object[]{e.getFirstname(),e.getSurname(), l, e.getSSN(), dc.getById(e.getDepartmentId())});
        }
        
        SimpleDataView sdv = new SimpleDataView(this.getFrame(), tm);
        sdv.setTitle("Showing specialists for domain: " + this.domCurrentObject.getName());
        sdv.setVisible(true);
    }
    
    @Action
    public void btnDomainShowSubprojects(){
        if(this.domCurrentObject.isNew())return;
        
        SubprojectCollection sc = this.domCurrentObject.getSubProjects();
        if(sc.size()==0)return;
        
        DefaultTableModel tm = new DefaultTableModel(new Object[]{"Subproject Name","Leader","Project","Game","Description"},0);
        ProjectCollection pc = new ProjectCollection().load();
        EmployeeCollection ec = new EmployeeCollection().load();
        GameCollection gc = new GameCollection().load();
        
        for(Subproject s : sc){
            Project p = pc.getById(s.getProjectId());
            
            tm.addRow(new Object[]{s,ec.getById(s.getLeadId()),p,gc.getById(p.getGameId()), s.getDescription()});
        }
        
        SimpleDataView sdv = new SimpleDataView(this.getFrame(),tm);
        sdv.setTitle("Showing all subprojects linked to domain: "+this.domCurrentObject.getName());
        sdv.setVisible(true);
    }
    
    private void employeeTab_activated(){
        EmployeeCollection ec = new EmployeeCollection().load();
        DepartmentCollection dc = new DepartmentCollection().load();
        DefaultTableModel tm = (DefaultTableModel)this.tEmployees.getModel();
        tm.getDataVector().removeAllElements();
        
        for(Employee e : ec){
            tm.addRow(new Object[]{e, dc.getById(e.getDepartmentId())});
        }
        tm.fireTableStructureChanged();
        
        this.cbEmployeeDept.removeAllItems();
        for(Department d : dc){
            this.cbEmployeeDept.addItem(d);
        }
        
        this.tEmployees.getSelectionModel().setSelectionInterval(0, 0);
    }
    
    private void tEmployees_valueChanged(ListSelectionEvent e){
        Integer i = this.tEmployees.getSelectedRow();
        
        try{
            this.empCurrentObject = (Employee)this.tEmployees.getValueAt(i, 0);
        }catch(Exception ex){
            return;
        }
        
        this.tfEmployeeFName.setText(this.empCurrentObject.getFirstname());
        this.tfEmployeeSurname.setText(this.empCurrentObject.getSurname());
        this.tfEmployeeSSN.setText(this.empCurrentObject.getSSN());
        this.cbEmployeeDept.setSelectedItem(this.empCurrentObject.getDepartment());
    }
    
    @Action
    public void btnEmployeeDelete_click(){        
        if(this.empCurrentObject.isNew()){
            this.btnEmployeeNew_click();
        }else{
            if(this.empCurrentObject.delete()){
                JOptionPane.showMessageDialog(this.getFrame(), "The Employee was successfully deleted.","Deletion Successful!", JOptionPane.INFORMATION_MESSAGE);
                
                this.employeeTab_activated();
            }else{
                JOptionPane.showMessageDialog(this.getFrame(), "The Employee could not be deleted.","Deletion Failed!",JOptionPane.ERROR_MESSAGE);
            }
        }
    }
    
    @Action
    public void btnEmployeeNew_click(){
        this.empCurrentObject=new Employee();
        
        this.tfEmployeeFName.setText("");
        this.tfEmployeeSurname.setText("");
        this.tfEmployeeSSN.setText("");
        this.cbEmployeeDept.setSelectedIndex(0);
    }
    
    @Action
    public void btnEmployeeSave_click(){
        String 
                firstname = this.tfEmployeeFName.getText(),
                surname = this.tfEmployeeSurname.getText(),
                ssn = this.tfEmployeeSSN.getText();
        Department d = (Department)this.cbEmployeeDept.getSelectedItem();
        
        /**
         * TODO: Validate Input
         */
        
        if(true){
            this.empCurrentObject.setFirstname(firstname);
            this.empCurrentObject.setSurname(surname);
            this.empCurrentObject.setSSN(ssn);
            this.empCurrentObject.setDepartment(d);
            
            if(this.empCurrentObject.save()){
                this.employeeTab_activated();
                
                JOptionPane.showMessageDialog(this.getFrame(), "The Employee was successfully saved.", "Save Successful", JOptionPane.INFORMATION_MESSAGE);
            }else{
                JOptionPane.showMessageDialog(this.getFrame(), "The Employee could not be saved.", "Save Failed", JOptionPane.ERROR_MESSAGE);
            }
        }
    }
    
    @Action
    public void btnEmployeeShowDomains_click(){
        if(this.empCurrentObject.isNew())return;
        
        DomainCollection dc = this.empCurrentObject.getSpecialities();
        if(dc.size()==0)return;
        
        DefaultTableModel tm = new DefaultTableModel(new Object[]{"Domain Name","Level","Leader","Department"},0);
        
        EmployeeCollection ec = new EmployeeCollection().load();
        DepartmentCollection dtc = new DepartmentCollection().load();
        
        for(Domain d : dc){
            tm.addRow(new Object[]{d, this.empCurrentObject.getSpecialityLevel(d), ec.getById(d.getLeadId()), dtc.getById(d.getDepartmentId())});
        }
        
        SimpleDataView sdv = new SimpleDataView(this.getFrame(), tm);
        sdv.setTitle("Showing specialities of "+this.empCurrentObject.toString());
        sdv.setVisible(true);
    }
    
    @Action
    public void btnEmployeeShowSubprojects_click(){
        if(this.empCurrentObject.isNew())return;
        
        SubprojectCollection sc = this.empCurrentObject.getSubprojects();
        if(sc.size()==0)return;
        
        DefaultTableModel tm = new DefaultTableModel(new Object[]{"Subproject Name","Leader","Domain","Project","Game","Description"},0);
        
        DomainCollection dc = new DomainCollection().load();
        EmployeeCollection ec = new EmployeeCollection().load();
        GameCollection gc = new GameCollection().load();
        
        for(Subproject s : sc){
            Project p = s.getProject();
            tm.addRow(new Object[]{s,ec.getById(s.getLeadId()),dc.getById(s.getDomainId()),p, gc.getById(p.getGameId()),s.getDescription()});
        }
        
        SimpleDataView sdv = new SimpleDataView(this.getFrame(), tm);
        sdv.setTitle("Showing subprojects of " + this.empCurrentObject.toString());
        sdv.setVisible(true);
    }

    private void gameTab_activated(){
        GameCollection gc = new GameCollection().load(); 
        EmployeeCollection ec  = new EmployeeCollection().load();
        DefaultTableModel tm = (DefaultTableModel)this.tGames.getModel();
        tm.getDataVector().removeAllElements();
        
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        for(Game g : gc){
            tm.addRow(new Object[]{g, sdf.format(g.getStartDate()), sdf.format(g.getDeadline()), ec.getById(g.getLeadId())});
        }
        tm.fireTableStructureChanged();
        
        this.cbGameLead.removeAllItems();
        for(Employee e : ec){
            this.cbGameLead.addItem(e);
        }        
        
        this.tGames.getSelectionModel().setSelectionInterval(0, 0);
    }
    
    private void tGames_valueChanged(ListSelectionEvent e){
        Integer i = this.tGames.getSelectedRow();
        
        try{
            this.gameCurrentObject = (Game)this.tGames.getValueAt(i, 0);
        }catch(Exception ex){
            return;
        }
        
        this.tfGameName.setText(this.gameCurrentObject.getName());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        this.tfGameStart.setText(sdf.format(this.gameCurrentObject.getStartDate()));
        this.tfGameDeadline.setText(sdf.format(this.gameCurrentObject.getDeadline()));
        this.cbGameLead.setSelectedItem(this.gameCurrentObject.getLead());
    }
    
    private void projectTab_activated(){
        ProjectCollection pc = new ProjectCollection().load();
        EmployeeCollection ec = new EmployeeCollection().load();
        DepartmentCollection dc = new DepartmentCollection().load();
        GameCollection gc = new GameCollection().load();
        DefaultTableModel tm = (DefaultTableModel)this.tProjects.getModel();
        tm.getDataVector().removeAllElements();
        
        for(Project p : pc){
            tm.addRow(new Object[]{p, ec.getById(p.getLeadId()), dc.getById(p.getDepartmentId()), gc.getById(p.getGameId())});
        }
        
        this.cbProjectLead.removeAllItems();
        for(Employee e : ec){
            this.cbProjectLead.addItem(e);
        }
        
        this.cbProjectDept.removeAllItems();
        for(Department d : dc){
            this.cbProjectDept.addItem(d);
        }
        
        this.cbProjectGame.removeAllItems();
        for(Game g : gc){
            this.cbProjectGame.addItem(g);
        }
        
        this.tProjects.getSelectionModel().setSelectionInterval(0, 0);
    }
    
    private void tProjects_valueChanged(ListSelectionEvent e){
        Integer i = this.tProjects.getSelectedRow();
        
        try{
            this.projCurrentObject = (Project)this.tProjects.getValueAt(i, 0);
        }catch(Exception ex){
            return;
        }
        
        this.tfProjectName.setText(this.projCurrentObject.getName());
        this.cbProjectLead.setSelectedItem(this.projCurrentObject.getLead());
        this.cbProjectDept.setSelectedItem(this.projCurrentObject.getDepartment());
        this.cbProjectGame.setSelectedItem(this.projCurrentObject.getGame());
        this.taProjectDesc.setText(this.projCurrentObject.getDescription());
    }
    
    private void subprojectTab_activated(){
        SubprojectCollection sc = new SubprojectCollection().load();
        EmployeeCollection ec = new EmployeeCollection().load();
        DomainCollection dc = new DomainCollection().load();
        ProjectCollection pc = new ProjectCollection().load();
        GameCollection gc = new GameCollection().load();
        DefaultTableModel tm = (DefaultTableModel)this.tSubprojects.getModel();
        tm.getDataVector().removeAllElements();
        
        for(Subproject s : sc){
            Project p = pc.getById(s.getProjectId());
            tm.addRow(new Object[]{s,ec.getById(s.getLeadId()),dc.getById(s.getDomainId()),pc.getById(s.getProjectId()), gc.getById(p.getGameId())});
        }
        
        this.cbSubprojectLead.removeAllItems();
        for(Employee e : ec){
            this.cbSubprojectLead.addItem(e);
        }
        
        this.cbSubprojectDomain.removeAllItems();
        for(Domain d : dc){
            this.cbSubprojectDomain.addItem(d);
        }
        
        this.cbSubprojectProject.removeAllItems();
        for(Project p : pc){
            this.cbSubprojectProject.addItem(p);
        }
        
        this.tSubprojects.getSelectionModel().setSelectionInterval(0, 0);
    }
    
    private void tSubprojects_valueChanged(ListSelectionEvent e){
        Integer i = this.tSubprojects.getSelectedRow();
        
        try{
            this.subpCurrentObject = (Subproject)this.tSubprojects.getValueAt(i, 0);
        }catch(Exception ex){
            return;
        }
        
        this.tfSubprojectName.setText(this.subpCurrentObject.getName());
        this.cbSubprojectLead.setSelectedItem(this.subpCurrentObject.getLead());
        this.cbSubprojectDomain.setSelectedItem(this.subpCurrentObject.getDomain());
        this.cbSubprojectProject.setSelectedItem(this.subpCurrentObject.getProject());
        this.taSubprojectDesc.setText(this.subpCurrentObject.getDescription());
    }
        
    @Action
    public void miAbout_click() {
        AboutBox ab = new AboutBox(this.getFrame(), true);
        ab.setVisible(true);
    }

    @Action
    public void btnGameDelete_click() {
        if(!this.gameCurrentObject.isNew()){
            if(this.gameCurrentObject.delete()){
                this.gameTab_activated();
                
                JOptionPane.showMessageDialog(this.getFrame(), "The selected game was deleted successfully.", "Deletion Successful", JOptionPane.INFORMATION_MESSAGE);
            }else{
                JOptionPane.showMessageDialog(this.getFrame(), "The Game could not be deleted.","Deletion Failed!",JOptionPane.ERROR_MESSAGE);
            }
        }else{
            this.btnGameNew_click();
        }
    }

    @Action
    public void btnGameNew_click() {
        this.gameCurrentObject=new Game();
        
        this.tfGameName.setText("");
        this.tfGameStart.setText("");
        this.tfGameDeadline.setText("");
        this.cbGameLead.setSelectedIndex(0);
    }

    @Action
    public void btnGameSave_click() {
        String
                name = this.tfGameName.getText(),
                start = this.tfGameStart.getText(),
                dl = this.tfGameDeadline.getText();
        Employee lead = (Employee)this.cbGameLead.getSelectedItem();
        
        /**
         * TODO: Validate Input
         */
        
        if(true){
            Date startDate, deadline;
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");        
            
            try{
                startDate = sdf.parse(start);
                deadline = sdf.parse(dl);
            }catch(Exception e){
                /**
                 * TODO: Handle Exception
                 */
                return;
            }
            
            
            this.gameCurrentObject.setName(name);
            this.gameCurrentObject.setStartDate(startDate);
            this.gameCurrentObject.setDeadline(deadline);
            this.gameCurrentObject.setLead(lead);
            
            if(this.gameCurrentObject.save()){
                this.gameTab_activated();
                
                JOptionPane.showMessageDialog(this.getFrame(), "The game was successfully saved.", "Save Successful", JOptionPane.INFORMATION_MESSAGE);
            }else{
                JOptionPane.showMessageDialog(this.getFrame(), "The game could not be saved.", "Save Failed", JOptionPane.ERROR_MESSAGE);
            }
        }
    }

    @Action
    public void btnGameShowProjects_click() {
        if(this.gameCurrentObject.isNew())return;
        
        ProjectCollection pc = this.gameCurrentObject.getProjects();
        if(pc.size()==0)return;
        
        DefaultTableModel tm = new DefaultTableModel(new Object[]{"Project Name","Leader","Department"},0);
        
        EmployeeCollection ec = new EmployeeCollection().load();
        DepartmentCollection dc = new DepartmentCollection().load();
        
        for(Project p : pc){
            tm.addRow(new Object[]{p,ec.getById(p.getLeadId()),dc.getById(p.getGameId())});
        }
        
        SimpleDataView sdv = new SimpleDataView(this.getFrame(), tm);
        sdv.setTitle("Showing all Projects for Game: "+this.gameCurrentObject.toString());
        sdv.setVisible(true);
    }

    @Action
    public void btnGameShowEmployees_click() {
        if(this.gameCurrentObject.isNew())return;
        
        ProjectCollection pc = this.gameCurrentObject.getProjects();
        if(pc.size()==0)return;
        
        DefaultTableModel tm = new DefaultTableModel(new Object[]{"First Name","Surname","Social Security Number"},0);
        
        for(Project p : pc){
            SubprojectCollection sc = p.getSubprojects();
            for(Subproject s : sc){
                EmployeeCollection ec = s.getAssignedEmployees();
                for(Employee e : ec){
                     tm.addRow(new Object[]{e.getFirstname(), e.getSurname(), e.getSSN()});
                }
            }
        }
        
        if(tm.getRowCount()==0){
            return;
        }
        
        SimpleDataView sdv = new SimpleDataView(this.getFrame(), tm);
        sdv.setTitle("Showing all Employees for Game: "+this.gameCurrentObject.toString());
        sdv.setVisible(true);
    }

    @Action
    public void btnGameShowInDev_click() {
        GameCollection gc = new GameCollection().load();
        if(gc.size()==0)return;
        
        DefaultTableModel tm = new DefaultTableModel(new Object[]{"Game Name","Start Date","Deadline","Leader"},0);
        EmployeeCollection ec = new EmployeeCollection().load();
        
        Calendar now = Calendar.getInstance();
        Date d = now.getTime();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        for(Game g : gc){
            if(g.getStartDate().before(d)&&g.getDeadline().after(d)){
                tm.addRow(new Object[]{g,sdf.format(g.getStartDate()),sdf.format(g.getDeadline()),ec.getById(g.getLeadId())});
            }
        }
        
        SimpleDataView sdv = new SimpleDataView(this.getFrame(),tm);
        sdv.setTitle("Showing all Games in development.");
        sdv.setVisible(true);
    }

    @Action
    public void btnProjectDelete_click() {
        if(!this.projCurrentObject.isNew()){
            if(this.projCurrentObject.delete()){
                this.projectTab_activated();
                
                JOptionPane.showMessageDialog(this.getFrame(), "The selected project was deleted successfully.", "Deletion Successful", JOptionPane.INFORMATION_MESSAGE);
            }else{
                JOptionPane.showMessageDialog(this.getFrame(), "The Project could not be deleted.","Deletion Failed!",JOptionPane.ERROR_MESSAGE);
            }
        }else{
            this.btnProjectNew_click();
        }
    }

    @Action
    public void btnProjectNew_click() {
        this.projCurrentObject=new Project();
        
        this.tfProjectName.setText("");
        this.cbProjectLead.setSelectedIndex(0);
        this.cbProjectDept.setSelectedIndex(0);
        this.cbProjectGame.setSelectedIndex(0);
        this.taProjectDesc.setText("");
    }

    @Action
    public void btnProjectSave_click() {
        String name = this.tfProjectName.getText();
        Employee lead = (Employee)this.cbProjectLead.getSelectedItem();
        Department dept = (Department)this.cbProjectDept.getSelectedItem();
        Game game = (Game)this.cbProjectGame.getSelectedItem();
        
        /**
         * TODO: Validate input
         */
        
        if(true){
            this.projCurrentObject.setName(name);
            this.projCurrentObject.setLead(lead);
            this.projCurrentObject.setGame(game);
            this.projCurrentObject.setDepartment(dept);
            
            if(this.projCurrentObject.save()){
                this.projectTab_activated();
                
                JOptionPane.showMessageDialog(this.getFrame(), "The project was successfully saved.", "Save Successful", JOptionPane.INFORMATION_MESSAGE);
            }else{
                JOptionPane.showMessageDialog(this.getFrame(), "The project could not be saved.", "Save Failed", JOptionPane.ERROR_MESSAGE);
            }
        }
    }

    @Action
    public void btnProjectShowSubprojects_click() {
        if(this.projCurrentObject.isNew())return;
        
        SubprojectCollection sc = this.projCurrentObject.getSubprojects();
        if(sc.size()==0)return;
        
        Game g = this.projCurrentObject.getGame();
        EmployeeCollection ec = new EmployeeCollection().load();
        DomainCollection dc = new DomainCollection().load();
        DefaultTableModel tm = new DefaultTableModel(new Object[]{"Subproject Name","Leader","Domain","Game","Description"},0);
        
        for(Subproject s : sc){
            tm.addRow(new Object[]{s,ec.getById(s.getLeadId()),dc.getById(s.getDomainId()),g,s.getDescription()});
        }       
        
        SimpleDataView sdv = new SimpleDataView(this.getFrame(),tm);
        sdv.setTitle("Showing all subprojects to project: "+this.projCurrentObject.toString());
        sdv.setVisible(true);
    }

    @Action
    public void btnProjectShowDev_click() {
        ProjectCollection pc = new ProjectCollection().load();
        if(pc.size()==0)return;
        
        Calendar cal = Calendar.getInstance();
        GameCollection gc = new GameCollection().load();
        EmployeeCollection ec = new EmployeeCollection().load();
        DefaultTableModel tm = new DefaultTableModel(new Object[]{"Project Name","Leader","Game"},0);
        
        for(Project p : pc){
            Game g = gc.getById(p.getGameId());
            
            Calendar now = Calendar.getInstance();
            Date d = now.getTime();
            if(g.getStartDate().before(d)&&g.getDeadline().after(d)){
                tm.addRow(new Object[]{p,ec.getById(p.getLeadId()),g});
            }
                
        }
        
        SimpleDataView sdv = new SimpleDataView(this.getFrame(), tm);
        sdv.setTitle("Showing all Projects In Development");
        sdv.setVisible(true);
    }

    @Action
    public void btnSubprojectDelete_click() {
        if(!this.subpCurrentObject.isNew()){
            if(this.subpCurrentObject.delete()){
                this.subprojectTab_activated();
                
                JOptionPane.showMessageDialog(this.getFrame(), "The selected subproject was deleted successfully.", "Deletion Successful", JOptionPane.INFORMATION_MESSAGE);
            }else{
                JOptionPane.showMessageDialog(this.getFrame(), "The Subproject could not be deleted.","Deletion Failed!",JOptionPane.ERROR_MESSAGE);
            }
        }else{
            this.btnSubprojectNew_click();
        }
    }

    @Action
    public void btnSubprojectNew_click() {
        this.subpCurrentObject=new Subproject();
        
        this.tfSubprojectName.setText("");
        this.cbSubprojectLead.setSelectedIndex(0);
        this.cbSubprojectDomain.setSelectedIndex(0);
        this.cbSubprojectProject.setSelectedIndex(0);
        this.taSubprojectDesc.setText("");
    }

    @Action
    public void btnSubprojectSave_click() {
        String name = this.tfSubprojectName.getText(), desc = this.taSubprojectDesc.getText();
        Employee lead = (Employee)this.cbSubprojectLead.getSelectedItem();
        Domain domain = (Domain)this.cbSubprojectDomain.getSelectedItem();
        Project project = (Project)this.cbSubprojectProject.getSelectedItem();
        
        /**
         * TODO: Validate Input
         */
        
        if(true){
            this.subpCurrentObject.setName(name);
            this.subpCurrentObject.setDescription(desc);
            this.subpCurrentObject.setLead(lead);
            this.subpCurrentObject.setDomain(domain);
            this.subpCurrentObject.setProject(project);
            
            if(this.subpCurrentObject.save()){
                this.subprojectTab_activated();
                
                JOptionPane.showMessageDialog(this.getFrame(), "The subproject was successfully saved.", "Save Successful", JOptionPane.INFORMATION_MESSAGE);
            }else{
                JOptionPane.showMessageDialog(this.getFrame(), "The subproject could not be saved.", "Save Failed", JOptionPane.ERROR_MESSAGE);
            }
        }        
    }

    @Action
    public void btnSubprojectShowEmployees_click() {
        if(this.subpCurrentObject.isNew())return;
        
        EmployeeCollection ec = this.subpCurrentObject.getAssignedEmployees();
        if(ec.size()==0)return;
        
        DefaultTableModel tm = new DefaultTableModel(new Object[]{"First Name","Surname","Social Security Number"},0);
        
        for(Employee e : ec){
            tm.addRow(new Object[]{e.getFirstname(), e.getSurname(), e.getSSN()});
        }
        
        SimpleDataView sdv = new SimpleDataView(this.getFrame(), tm);
        sdv.setTitle("Showing all Employees for Subproject: "+this.subpCurrentObject.toString());
        sdv.setVisible(true);
    }

    @Action
    public void btnEmployeeEditLevels_click() {
        DomainSpecialistView dsv = new DomainSpecialistView(this.getFrame());
        dsv.setVisible(true);
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnDepartmentShowDomains;
    private javax.swing.JButton btnDepartmentShowEmployees;
    private javax.swing.JButton btnDepartmentShowProjects;
    private javax.swing.JButton btnDeptDel;
    private javax.swing.JButton btnDeptNew;
    private javax.swing.JButton btnDeptSave;
    private javax.swing.JButton btnDomDel;
    private javax.swing.JButton btnDomNew;
    private javax.swing.JButton btnDomSave;
    private javax.swing.JButton btnDomainShowSpecialists;
    private javax.swing.JButton btnDomainShowSubprojects;
    private javax.swing.JButton btnEmployeeDelete;
    private javax.swing.JButton btnEmployeeEditLevels;
    private javax.swing.JButton btnEmployeeNew;
    private javax.swing.JButton btnEmployeeSave;
    private javax.swing.JButton btnEmployeeShowSpecialities;
    private javax.swing.JButton btnEmployeeShowSubprojects;
    private javax.swing.JButton btnGameDelete;
    private javax.swing.JButton btnGameNew;
    private javax.swing.JButton btnGameSave;
    private javax.swing.JButton btnGameShowEmployees;
    private javax.swing.JButton btnGameShowInDev;
    private javax.swing.JButton btnGameShowProjects;
    private javax.swing.JButton btnProjectDelete;
    private javax.swing.JButton btnProjectNew;
    private javax.swing.JButton btnProjectSave;
    private javax.swing.JButton btnProjectShowDev;
    private javax.swing.JButton btnProjectShowSubprojects;
    private javax.swing.JButton btnSubprojectDelete;
    private javax.swing.JButton btnSubprojectNew;
    private javax.swing.JButton btnSubprojectSave;
    private javax.swing.JButton btnSubprojectShowEmployees;
    private javax.swing.JComboBox cbDeptLead;
    private javax.swing.JComboBox cbDomainDept;
    private javax.swing.JComboBox cbDomainLead;
    private javax.swing.JComboBox cbEmployeeDept;
    private javax.swing.JComboBox cbGameLead;
    private javax.swing.JComboBox cbProjectDept;
    private javax.swing.JComboBox cbProjectGame;
    private javax.swing.JComboBox cbProjectLead;
    private javax.swing.JComboBox cbSubprojectDomain;
    private javax.swing.JComboBox cbSubprojectLead;
    private javax.swing.JComboBox cbSubprojectProject;
    private javax.swing.JLabel lblDeptLead;
    private javax.swing.JLabel lblDeptName;
    private javax.swing.JLabel lblDeptNameError;
    private javax.swing.JLabel lblDomainDept;
    private javax.swing.JLabel lblDomainLead;
    private javax.swing.JLabel lblDomainName;
    private javax.swing.JLabel lblDomainNameError;
    private javax.swing.JLabel lblEmployeeDept;
    private javax.swing.JLabel lblEmployeeFNameErr;
    private javax.swing.JLabel lblEmployeeFirstname;
    private javax.swing.JLabel lblEmployeeSNameErr;
    private javax.swing.JLabel lblEmployeeSSN;
    private javax.swing.JLabel lblEmployeeSSNErr;
    private javax.swing.JLabel lblEmployeeSurname;
    private javax.swing.JLabel lblGameDeadline;
    private javax.swing.JLabel lblGameDeadlineError;
    private javax.swing.JLabel lblGameLeader;
    private javax.swing.JLabel lblGameName;
    private javax.swing.JLabel lblGameNameError;
    private javax.swing.JLabel lblGameStart;
    private javax.swing.JLabel lblGameStartError;
    private javax.swing.JLabel lblProjectDept;
    private javax.swing.JLabel lblProjectDesc;
    private javax.swing.JLabel lblProjectGame;
    private javax.swing.JLabel lblProjectLead;
    private javax.swing.JLabel lblProjectName;
    private javax.swing.JLabel lblProjectNameError;
    private javax.swing.JLabel lblSubprojectDescription;
    private javax.swing.JLabel lblSubprojectDomain;
    private javax.swing.JLabel lblSubprojectLead;
    private javax.swing.JLabel lblSubprojectName;
    private javax.swing.JLabel lblSubprojectNameError;
    private javax.swing.JLabel lblSubprojectProject;
    private javax.swing.JMenu mHelp;
    private javax.swing.JMenuBar mbTopMenu;
    private javax.swing.JMenuItem miAbout;
    private javax.swing.JPanel pDepartment;
    private javax.swing.JPanel pDomain;
    private javax.swing.JPanel pEmployee;
    private javax.swing.JPanel pGame;
    private javax.swing.JPanel pMainPanel;
    private javax.swing.JPanel pProject;
    private javax.swing.JPanel pSubproject;
    private javax.swing.JScrollPane spDepartmentList;
    private javax.swing.JScrollPane spDomainList;
    private javax.swing.JScrollPane spEmployeeList;
    private javax.swing.JScrollPane spGameList;
    private javax.swing.JScrollPane spProjectDesc;
    private javax.swing.JScrollPane spProjectList;
    private javax.swing.JScrollPane spSubprojectDesc;
    private javax.swing.JScrollPane spSubprojectList;
    private javax.swing.JTable tDepartments;
    private javax.swing.JTable tDomains;
    private javax.swing.JTable tEmployees;
    private javax.swing.JTable tGames;
    private javax.swing.JTable tProjects;
    private javax.swing.JTable tSubprojects;
    private javax.swing.JTextArea taProjectDesc;
    private javax.swing.JTextArea taSubprojectDesc;
    private javax.swing.JTextField tfDepartmentName;
    private javax.swing.JTextField tfDomainName;
    private javax.swing.JTextField tfEmployeeFName;
    private javax.swing.JTextField tfEmployeeSSN;
    private javax.swing.JTextField tfEmployeeSurname;
    private javax.swing.JTextField tfGameDeadline;
    private javax.swing.JTextField tfGameName;
    private javax.swing.JTextField tfGameStart;
    private javax.swing.JTextField tfProjectName;
    private javax.swing.JTextField tfSubprojectName;
    private javax.swing.JTabbedPane tpMainContent;
    // End of variables declaration//GEN-END:variables
}
